<{include file="../modules/_manager/header.html" title='厂家'}>
<script src="<{$ROOTPATH}>/_manager/scripts/vars/mon.js.php"></script>
<script> jQuery(function($){money.init();}); </script>
<div class="block">
	<h1>マネー管理ページ</h1>
	<h2><a class="typeLink" onclick="money.todo(0,2)">入出金新規作成する</a></h2>
	<div class="money_sel">
		<strong>条件付き検索：</strong>
		<select id="money_audit_sel">
			<option value="-1">審査状況すべて</option>
			<option value="0">審査待ち</option>
			<option value="1">審査済み</option>
			<option value="2">誤あり</option>
		</select>
		<select id="money_payment_sel">
			<option value="-1">入出金すべて</option>
			<option value="0">入金</option>
			<option value="1">出金</option>
		</select>
		<select id="money_way_sel">
			<option value="-1">方法すべて</option>
			<{foreach $bank_listview as $entry}>
				<option value="<{$entry.bankId}>">
					<{$entry.bank}>
					<{if $entry.bankId gt 3}>
						(<{$entry.name}>)
					<{/if}>
				</option>
			<{/foreach}>
		</select>
		<select id="money_use_sel">
			<option value="-1">使い道すべて</option>
			<{foreach $use_array as $entry}>
				<option value="<{$entry@key}>"><{$entry}></option>
			<{/foreach}>
		</select>
		日付:<input id="money_dates_f_sel" readonly="readonly" size="10" class="date" value="<{$DATEFIRSTDAY}>" />～
		<input id="money_dates_l_sel" readonly="readonly" size="10" class="date" value="<{$DATENOW}>" />
		<a class="typeLink" onclick="money.todo(0,5)">検索</a>
		<div>
			現在表示してるのは<span class="same_b"><{$money_dates_f}></span>から
			<span class="same_b"><{$money_dates_l}></span>までの間のデータです。
			入金合計：<span class="typeMoney same_b"><{$account_sumin}></span> / 出金合計：
			<span class="typeMoney same_b"><{$account_sumout}></span>,
			その差は<span class="typeMoney same_b"><{$account_sumin-$account_sumout}></span> 
		</div>
	</div>
	
	<{*include file='modules/pagetag.html' _page=$page _qs=$qs _pagearr=$pagearr _pagecount=$pagecount _db_len=$len*}>
	<{$sumin = 0}>
	<{$sumout = 0}>
	<table class="table_list">
		<thead>
			<tr class="header">
				<td>日付</td>
				<td>入金</td>
				<td>出金</td>
				<td>方法</td>
				<td>使い道</td>
				<td>詳細</td>
				<td>審査状況</td>
				<td>編集</td>
				<{if $login_checker == 1}>
					<td>記入者</td>
				<{/if}>
				<td>審査者</td>
			</tr>
		</thead>
		<tbody class="listitem">
			
			<{if $len == 0}>
			<tr>
				<td colspan="9">
					<span class="blank_data">
						暂时没有类信息[<a class="typeLink" onclick="money.todo(0,2)">新規作成</a>]
					<span>
				</td>
			</tr>
			<{else}>
				<{foreach $listview as $entry}>
					<{if $entry@iteration is even by 1}>
						<tr class="iteration">
					<{else}>
						<tr>
					<{/if}>
					<td><{$entry.dates}></td>
					<{if $entry.payment == 0}>
						<{if $entry.audit == 1}>
							<{$sumin=$sumin+$entry.account}>
							<td class="typeMoney nline"><{$entry.account}></td>
						<{else}>
							<td class="typeMoney nline unaudit"><{$entry.account}></td>
						<{/if}>
						<td class="nline"></td>
					<{else}>
						<td class="nline"></td>
						<{if $entry.audit == 1}>
							<{$sumout=$sumout+$entry.account}>
							<td class="typeMoney nline">-<{$entry.account}></td>
						<{else}>
							<td class="typeMoney nline unaudit">-<{$entry.account}></td>
						<{/if}>
					<{/if}>
					<td class="nline"><{$entry.bank}>(<i><{$entry.name}></i>)</td>
					<td class="nline"><{$use_array[$entry.use]}></td>
					<td class="nline"><{$entry.info}></td>
					<td>
					<{if $entry.audit == 0}>
						<font color="gray">審査待</font>
						<{if ($login_checker == 1 or $login_adminId == 1) && $entry.adminId != $login_adminId}>
							<a class="typeLink" onclick="blockDesign.message( $(money.audit._name),'382px');
							$(money.audit.id).val('<{$entry.monId}>');">審査する</a>
						<{/if}>
					<{elseif $entry.audit == 1}>
						<font color="green">審査済み</font>
					<{elseif $entry.audit == 2}>
						<font color="red">誤あり</font>
					<{/if}>
					</td>
					<td>
					<{if $entry.audit == 2 && $entry.adminId == $login_adminId}>
						<a class="typeLink" onclick="money.todo(<{$entry.monId}>,0)">編集</a>
						<input type="hidden" value="<{$entry.dates}>" id="mon_dates_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.payment}>" id="mon_payment_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.account}>" id="mon_account_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.way}>" id="mon_way_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.use}>" id="mon_use_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.info}>" id="mon_info_hidden_<{$entry.monId}>">
					<{elseif $login_adminId == 3}>
						<a class="typeLink" onclick="money.todo(<{$entry.monId}>,0)">編集</a>
						<input type="hidden" value="<{$entry.dates}>" id="mon_dates_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.payment}>" id="mon_payment_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.account}>" id="mon_account_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.way}>" id="mon_way_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.use}>" id="mon_use_hidden_<{$entry.monId}>">
						<input type="hidden" value="<{$entry.info}>" id="mon_info_hidden_<{$entry.monId}>">
					<{elseif $entry.audit == 0 or $entry.audit == 1}>
						<font color="gray">編集不可</font>
					<{else}>
						<font color="gray">編集不可</font>
					<{/if}>
					</td>
					<{if $login_checker == 1}>
						<td><{$entry.admin_name}></td>
					<{/if}>
					<td>
						<{$entry.auditName}>
					</td>
					</tr>
				<{/foreach}>
			<{/if}>
		</tbody>
		<tfoot class="header">
			<tr>
				<td></td>
				<td class="typeMoney"><{$sumin}></td>
				<td class="typeMoney"><{$sumout}></td>
				<{if $login_checker == 1}>
					<td colspan="7"></td>
				<{else}>
					<td colspan="6"></td>
				<{/if}>
			</tr>
		</tfoot>
	</table>
	<{include file='../modules/pagetag.html' _page=$page _qs=$qs _pagearr=$pagearr _pagecount=$pagecount _db_len=$len}>
</div>


<div id="newmon_form" class="new_form" style="display:none;">
	<div id="newmon_form_title"></div>
	<div>
		<table>
			<tr>
				<td>日付:</td>
				<td><input type="text" readonly="readonly" size="10"  id="new_form_dates" class="date" value="<{$DATENOW}>"></td>
			</tr>
			<tr>
				<td>金額:</td>
				<td><input type="text" id="new_form_account" size="6" onChange="utilityHandle.toHankaku(this)" /></td>
			</tr>
			<tr>
				<td>入出:</td>
				<td>
					<select id="new_form_payment">
						<option value="0">収入</option>
						<option value="1">支出</option>
					</select>
				</td>
			</tr>
			<tr>
				<td>方法:</td>
				<td>
					<select id="new_form_way">
						<{foreach $bank_listview as $entry}>
							<option value="<{$entry.bankId}>">
								<{$entry.bank}>
								<{if $entry.bankId gt 3}>
									(<{$entry.name}>)
								<{/if}>
							</option>
						<{/foreach}>
					</select>
				</td>
			</tr>
			<tr>
				<td>使い道:</td>
				<td>
					<!--这里需要按照等级来分配显示内容-->
					<select id="new_form_use">
						<{foreach $use_array as $entry}>
							<option value="<{$entry@key}>"><{$entry}></option>
						<{/foreach}>
					</select>
				</td>
			</tr>
			<tr>
				<td>詳細：</td>
				<td>
					<!--这里需要按照等级来分配显示内容-->
					<input type="text" value="" id="new_form_info" />
				</td>
			</tr>
		</table>
		<input type="hidden" value="0" id="mon_id_hidden">
	 	<a class="typeLink" id="new_form_ok" onclick="if($('#mon_id_hidden').val()==0) money.add(); else money.update();">新規作成</a>
		<a class="typeLink" onclick="$.unblockUI();">Close</a>
	</div>
</div>

<div id="audit_form" class="new_form" style="display:none;">
	<div>
		問題なければ、審査を通過します。
	</div>
	<div>
		<a class="typeLink" onclick="money.todo(1,4)">審査を通過する</a> 
		<a class="typeLink" onclick="money.todo(2,4)">審査を通過しない</a> 
		<a class="typeLink" onclick="$.unblockUI();">キャンセル</a>
	</div>
	<input type="hidden" id="audit_mon_id" value="" />
</div>

<{include file="../modules/_manager/footer.html"}>